import nodemon from "nodemon";
import { ElectronHmr } from "electron-hmr";
import Electron from "electron";
import Path from "path";
// import { exec } from "./nuxt-build.mjs";

(async () => {
  // exec("npm run dev");
  nodemon({
    watch: ["backend", "dev-tools"],
    ext: "ts,mjs,js,json,graphql",
    exec: "node dev-tools/es-build.mjs",
    legacyWatch: true,
  });

  let eHmr = new ElectronHmr({
    electronBinaryPath: Electron.toString(),
  });

  eHmr.watch({
    include: [Path.resolve("backend.js")],
  });
})();
